<?php

require_once dirname(__FILE__).'/../lib/razredGeneratorConfiguration.class.php';
require_once dirname(__FILE__).'/../lib/razredGeneratorHelper.class.php';

/**
 * razred actions.
 *
 * @package    dnevnik
 * @subpackage razred
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 12474 2008-10-31 10:41:27Z fabien $
 */
class razredActions extends autoRazredActions
{
    public function executeAjaxList(sfWebRequest $request)
    {
        $txt = "<option value=''></option>";
        $razreds = DbFinder::from('Razred')->where('SkolaId', $request->getParameter('skola_id'))->find();
        foreach($razreds as $razred)
        {
            if($razred->getSmer()->getTip() == SmerPeer::$tip['redovni'])
              $txt .= "<option value='".$razred->getId()."'>".(string)$razred."</option>";
            else if($razred->getSmer()->getTip() == SmerPeer::$tip['kombinovani'])
              $txt .= "<option value='".$razred->getId()."'>kom - ".(string)$razred."</option>";
            else if($razred->getSmer()->getTip() == SmerPeer::$tip['grupni'])
              $txt .= "<option value='".$razred->getId()."'>gru - ".(string)$razred."</option>";
        }
        return $this->renderText($txt);
    }
}
